#pragma once
#include<iostream>
#include<string>
#include"Util.hpp"
namespace ns_log
{
    using namespace ns_util;
    enum
    {
        INFO,
        DEBUG,
        WARNING,
        ERROR,
        FATAL
    };
    static std::ostream& Log(const std::string& level,const std::string& file,const int line)
    {
        //添加日记等级
        std::string message="[";
        message+=level;
        message+="]";

        //添加文件名
        message+="[";
        message+=file;
        message+="]";

        //添加行数
        message+="[";
        message+=std::to_string(line);
        message+="]";

        //添加时间戳
        message+="[";
        message+=TimeUtil::Gettimestamp();
        message+="]";
        std::cout<<message;//有缓冲区，没刷新会保留在缓冲区里

        return std::cout;
    }
#define LOG(level);Log(#level, __FILE__, __LINE__)
//#define LOG(level) Log(#level, __FILE__, __LINE__)
}
